package com.hejia.bulbul.entity;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 按日统计渠道数据
 * 
 * @author hyr
 *
 */
public class ChannelDayStatistic {

	private Date date; // 日期
	private Long registerCount; // 当日注册用户数
	private Long allRegisterCount; // 当日所有渠道注册用户数
	private Long accumulativeRegisterCount; // 累计到当日注册用户数
	private Long newTradeUserCount; // 当日新增交易用户数
	private Long allNewTradeUserCount; // 当日所有渠道新增交易用户数
	private Long accumulativeTradeUserCount; // 累计到当日交易用户数
	private Long allAccumulativeTradeUserCount; // 所有渠道累计到当日交易用户数
	private BigDecimal tradeAmount; // 当日交易金额
	private BigDecimal accumulativeTradeAmount; // 累计到当日交易金额
	private BigDecimal allTradeAmount; // 当日所有渠道交易金额
	private Long newAppTradeUserCount; // 新增App交易用户数
	private Long accumulativeAppTradeUserCount; // 累计App交易用户数
	private Long allNewAppTradeUserCount; // 所有渠道新增App交易用户数

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public Long getRegisterCount() {
		if(this.registerCount == null){
			this.registerCount = 0L;
		}
		return registerCount;
	}

	public void setRegisterCount(Long registerCount) {
		this.registerCount = registerCount;
	}

	public Long getAllRegisterCount() {
		if(this.allRegisterCount == null){
			this.allRegisterCount = 0L;
		}
		return allRegisterCount;
	}

	public void setAllRegisterCount(Long allRegisterCount) {
		this.allRegisterCount = allRegisterCount;
	}

	public Long getAccumulativeRegisterCount() {
		if (accumulativeRegisterCount == null) {
			accumulativeRegisterCount = 0L;
		}
		return accumulativeRegisterCount;
	}

	public void setAccumulativeRegisterCount(Long accumulativeRegisterCount) {
		this.accumulativeRegisterCount = accumulativeRegisterCount;
	}

	public Long getNewTradeUserCount() {
		if(this.newTradeUserCount == null){
			this.newTradeUserCount = 0L;
		}
		return newTradeUserCount;
	}

	public void setNewTradeUserCount(Long newTradeUserCount) {
		this.newTradeUserCount = newTradeUserCount;
	}

	public Long getAllNewTradeUserCount() {
		if(this.allNewTradeUserCount == null){
			this.allNewTradeUserCount = 0L;
		}
		return allNewTradeUserCount;
	}

	public void setAllNewTradeUserCount(Long allNewTradeUserCount) {
		this.allNewTradeUserCount = allNewTradeUserCount;
	}

	public Long getAccumulativeTradeUserCount() {
		if(this.accumulativeTradeUserCount == null){
			this.accumulativeTradeUserCount = 0L;
		}
		return accumulativeTradeUserCount;
	}

	public void setAccumulativeTradeUserCount(Long accumulativeTradeUserCount) {
		this.accumulativeTradeUserCount = accumulativeTradeUserCount;
	}

	public Long getAllAccumulativeTradeUserCount() {
		if(this.allAccumulativeTradeUserCount == null){
			this.allAccumulativeTradeUserCount = 0L;
		}
		return allAccumulativeTradeUserCount;
	}

	public void setAllAccumulativeTradeUserCount(Long allAccumulativeTradeUserCount) {
		this.allAccumulativeTradeUserCount = allAccumulativeTradeUserCount;
	}

	public BigDecimal getTradeAmount() {
		if(this.tradeAmount == null){
			this.tradeAmount = BigDecimal.ZERO;
		}
		return tradeAmount;
	}

	public void setTradeAmount(BigDecimal tradeAmount) {
		this.tradeAmount = tradeAmount;
	}

	public BigDecimal getAccumulativeTradeAmount() {
		if(this.accumulativeTradeAmount == null){
			this.accumulativeTradeAmount = BigDecimal.ZERO;
		}
		return accumulativeTradeAmount;
	}

	public void setAccumulativeTradeAmount(BigDecimal accumulativeTradeAmount) {
		this.accumulativeTradeAmount = accumulativeTradeAmount;
	}

	public BigDecimal getAllTradeAmount() {
		if(this.allTradeAmount == null){
			this.allTradeAmount = BigDecimal.ZERO;
		}
		return allTradeAmount;
	}

	public void setAllTradeAmount(BigDecimal allTradeAmount) {
		this.allTradeAmount = allTradeAmount;
	}
	
	public Long getNewAppTradeUserCount() {
		if(this.newAppTradeUserCount == null){
			this.newAppTradeUserCount = 0L;
		}
		return newAppTradeUserCount;
	}

	public void setNewAppTradeUserCount(Long newAppTradeUserCount) {
		this.newAppTradeUserCount = newAppTradeUserCount;
	}

	public Long getAccumulativeAppTradeUserCount() {
		if(this.accumulativeAppTradeUserCount == null){
			this.accumulativeAppTradeUserCount = 0L;
		}
		return accumulativeAppTradeUserCount;
	}

	public void setAccumulativeAppTradeUserCount(Long accumulativeAppTradeUserCount) {
		this.accumulativeAppTradeUserCount = accumulativeAppTradeUserCount;
	}
	
	public Long getAllNewAppTradeUserCount() {
		if(this.allNewAppTradeUserCount == null){
			this.allNewAppTradeUserCount = 0L;
		}
		return allNewAppTradeUserCount;
	}

	public void setAllNewAppTradeUserCount(Long allNewAppTradeUserCount) {
		this.allNewAppTradeUserCount = allNewAppTradeUserCount;
	}

	/**
	 * 占当日新注册用户的比例
	 * 
	 * @return
	 */
	public double getRegisterRatio() {
		if(this.getAllRegisterCount() == 0){
			return 0;
		}
		return (double) this.getRegisterCount() / (double) this.getAllRegisterCount();
	}

	/**
	 * 占当日新增交易用户的比例
	 * 
	 * @return
	 */
	public double getNewTradeUserRatio() {
		if(this.getAllNewTradeUserCount() == 0){
			return 0;
		}
		return (double) this.getNewTradeUserCount() / (double) this.getAllNewTradeUserCount();
	}

	/**
	 * 累计交易用户数占所有渠道累计交易用户数的比例
	 * 
	 * @return
	 */
	public double getAccumulativeTradeUserRatio() {
		if(this.getAllAccumulativeTradeUserCount() == 0){
			return 0;
		}
		return (double) this.getAccumulativeTradeUserCount() / (double) this.getAllAccumulativeTradeUserCount();
	}

	/**
	 * 占当日总体交易金额的比例
	 * @return
	 */
	public BigDecimal getTradeAmountRatio() {
		if(this.getAllTradeAmount().compareTo(BigDecimal.ZERO) == 0){
			return BigDecimal.ZERO;
		}
		return this.getTradeAmount().divide(this.getAllTradeAmount(), 2);
	}
}
